<script setup>

import Select_CostType from "@/components/Select_CostType.vue";
import {reactive, ref} from "vue";
import TestVModel from "@/components/testVModel.vue";
import {getUUID} from "ant-design-vue/es/vc-dialog/util.js";
import axios from "axios";
import globalParams from "@/GlobalParams.js";
import {getUuid} from "ant-design-vue/es/vc-notification/HookNotification.js";
import {stringify} from "router-view/lib/path.js";

let selectedOption = reactive({value: '2', text: 'bbb'})

function abc() {
  console.log(selectedOption)
}

let selectedStars = ref(3)


function addUser() {
  let user = {}
  user.tableKey = getUuid();
  user.userName = "zs";
  user.password = getUuid().toString();
  user.realName = "张三"

  // axios.post('/users/addUser', user, {headers: {'Content-Type': 'application/json'}}).then((res) => {
  //   if (res.data === "success") {
  //
  //     alert("添加成功")
  //   }
  // })
  let paras = {}
  // console.log(stringify(user))
  paras.info = JSON.stringify(user);
  axios.post("/users/addUser2",paras).then((res) => {
    console.log(res);
  })
}
</script>

<template>
  <Select_CostType :selected-obj="selectedOption"></Select_CostType>
  <input type="button" value="aaaaa" @click="abc"/>
  {{ selectedOption }}

  <br>
  <br>
  <test-v-model :total-stars="10" v-model:selected-stars="selectedStars"></test-v-model>
  {{ selectedStars }}
  <br>
  <br> <br>
  <br>
  <input type="button" value="插入用户" @click="addUser"/>
</template>

<style scoped>

</style>